/****************************************************************************
Copyright 2006 Kervin L. Pierre
    EMAIL: otlkcon@adevsoft.com

This file is part of Otlkcon.

Otlkcon is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

Otlkcon is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Lesser GNU General Public License for more details.

You should have received a copy of the Lesser GNU General Public License
along with Otlkcon; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*******************************************************************************/

#include "StdAfx.h"


#include <map>

using namespace std;

class O_ITable;

class O_ITableView : IMAPITable
{
public:
    MAPI_IUNKNOWN_METHODS(IMPL);
    STDMETHODIMP GetLastError (HRESULT hResult,
        ULONG ulFlags,
        LPMAPIERROR * lppMAPIError);
    STDMETHODIMP Advise (ULONG ulEventMask,
        LPMAPIADVISESINK lpAdviseSink,
        ULONG * lpulConnection);
    STDMETHODIMP Unadvise (ULONG ulConnection);
    STDMETHODIMP GetStatus (ULONG * lpulTableStatus,
        ULONG * lpulTableType);
    STDMETHODIMP SetColumns (LPSPropTagArray lpPropTagArray,
        ULONG ulFlags);
    STDMETHODIMP QueryColumns (ULONG ulFlags,
        LPSPropTagArray * lpPropTagArray);
    STDMETHODIMP GetRowCount (ULONG ulFlags,
        ULONG * lpulCount);
    STDMETHODIMP SeekRow (BOOKMARK bkOrigin,
        LONG lRowCount,
        LONG * lplRowsSought);
    STDMETHODIMP SeekRowApprox (ULONG ulNumerator,
        ULONG ulDenominator);
    STDMETHODIMP QueryPosition (ULONG * lpulRow,
        ULONG * lpulNumerator,
        ULONG * lpulDenominator);
    STDMETHODIMP FindRow (LPSRestriction lpRestriction,
        BOOKMARK bkOrigin,
        ULONG ulFlags);
    STDMETHODIMP Restrict (LPSRestriction lpRestriction,
        ULONG ulFlags);
    STDMETHODIMP CreateBookmark (BOOKMARK * lpbkPosition);
    STDMETHODIMP FreeBookmark (BOOKMARK bkPosition);
    STDMETHODIMP SortTable (LPSSortOrderSet lpSortCriteria,
        ULONG ulFlags);
    STDMETHODIMP QuerySortOrder (LPSSortOrderSet * lppSortCriteria);
    STDMETHODIMP QueryRows(LONG lRowCount,
        ULONG ulFlags,
        LPSRowSet * lppRows);
    STDMETHODIMP Abort();
    STDMETHODIMP ExpandRow (ULONG cbInstanceKey,
        LPBYTE pbInstanceKey,
        ULONG ulRowCount,
        ULONG ulFlags,
        LPSRowSet * lppRows,
        ULONG * lpulMoreRows);
    STDMETHODIMP CollapseRow (ULONG cbInstanceKey,
        LPBYTE pbInstanceKey,
        ULONG ulFlags,
        ULONG * lpulRowCount);
    STDMETHODIMP WaitForCompletion (ULONG ulFlags,
        ULONG ulTimeout,
        ULONG * lpulTableStatus);
    STDMETHODIMP GetCollapseState (ULONG ulFlags,
        ULONG cbInstanceKey,
        LPBYTE lpbInstanceKey,
        ULONG * lpcbCollapseState,
        LPBYTE * lppbCollapseState);
    STDMETHODIMP SetCollapseState (ULONG ulFlags,
        ULONG cbCollapseState,
        LPBYTE pbCollapseState,
        BOOKMARK * lpbkLocation);

    O_ITableView(void);
    ~O_ITableView(void);

    STDMETHODIMP Create(LPMAPITABLE tbl, O_ITable *par);
    STDMETHODIMP Destroy();
    STDMETHODIMP Init(LPMAPITABLE tbl, O_ITable *par);

    LPMAPITABLE table;
    O_ITable *parent;

    map<ULONG, ULONG>   parentConnections;
    ULONG cRef;
    char * className; // For Debugging purposes
};